<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="app">
        <h1>{{msg}}</h1>
        <button @click="answer">坚伟</button>
        <button @click="answer1">回答二</button>
        <button @click="answer3">test全局mixin</button>
    </div>
    <div class="box">
        <h1>{{msg}}</h1>
        <button @click="answertutu">闰土回答</button>
        <button @click="answer3">test全局mixin</button>

    </div>
    <script src="../js/vue.js"></script>
    <script>
        // 全局混入
        Vue.mixin({
            methods:{
                answer3(){
                    console.log('。。。');
                }
            }
        })
        const mixin = {
            methods: {
                answer(){
                    console.log('还是可以的！！');
                }
            },
            created() {
                console.log('create');
            },
        }
        const mixin2 = {
           beforeMount() {
               console.log('补充说明，人生得意须尽欢，莫使jianwei空对月 ')
           },
        }
        let vm = new Vue({
            // el:'.app'
            data:{
                msg:'周坚伟热吗？？？？'
            },
            methods:{
                answer1(){
                    console.log('最好是白富美，大长腿！！！')
                }
            },
            // 混入（mixin）,混入一个对象，该对象中可以包含配置对象中的任何选项
            mixins:[mixin,mixin2]
        })
        vm.$mount('.app');
        let vm1 = new Vue({
            el:'.box',
            data:{
                msg:'闰土，漂亮吗？？'
            },
            methods:{
                answertutu(){
                    console.log('长夜漫漫！！')
                }
            }
        })
    </script>
</body>
</html>